package com.treasure.mall.biz.service.core.product.impl;

import com.treasure.mall.biz.base.AbstractSearchableCrudService;
import com.treasure.mall.biz.base.SpecificationAndSort;
import com.treasure.mall.biz.dto.BaseSaveDTO;
import com.treasure.mall.biz.dto.BaseSearchDTO;
import com.treasure.mall.biz.entity.product.ProductImgPO;
import com.treasure.mall.biz.repository.product.ProductImgRepository;
import com.treasure.mall.biz.service.core.product.ProductImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wm
 */
@Service
public class ProductImgServiceImpl extends AbstractSearchableCrudService<ProductImgPO, Long> implements ProductImgService {

    @Autowired
    private ProductImgRepository imgRepository;

    protected ProductImgServiceImpl(ProductImgRepository repository) {
        super(repository);
        imgRepository = repository;
    }

    @Override
    protected SpecificationAndSort<ProductImgPO> specificationAndSort(BaseSearchDTO searchDTO) {
        return null;
    }

    @Override
    public ProductImgPO save(BaseSaveDTO saveDTO) {
        return null;
    }

    @Override
    public List<ProductImgPO> getImgList(Long productId) {
        return imgRepository.findAllByProductIdOrderBySortNoAsc(productId);
    }
}